package com.san.hkhospital.service.impl;

import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.san.hkhospital.entity.StateExample;
import com.san.hkhospital.mapper.StateMapper;
import com.san.hkhospital.entity.State;
import com.san.hkhospital.service.StateService;
import org.springframework.transaction.annotation.Transactional;

/**
 * ClassName:StateServiceImpl
 * PackageName:com.san.hkhospital.service.impl
 * Description:
 *
 * @Author:yy
 * @CreatedAt:2024/11/13 14:38
 * 
 */
 
 
@Service
@Transactional
public class StateServiceImpl implements StateService{

    @Resource
    private StateMapper stateMapper;

    @Override
    public long countByExample(StateExample example) {
        return stateMapper.countByExample(example);
    }

    @Override
    public int deleteByExample(StateExample example) {
        return stateMapper.deleteByExample(example);
    }

    @Override
    public int deleteByPrimaryKey(Integer stateId) {
        return stateMapper.deleteByPrimaryKey(stateId);
    }

    @Override
    public int insert(State record) {
        return stateMapper.insert(record);
    }

    @Override
    public int insertSelective(State record) {
        return stateMapper.insertSelective(record);
    }

    @Override
    public List<State> selectByExample(StateExample example) {
        return stateMapper.selectByExample(example);
    }

    @Override
    public State selectByPrimaryKey(Integer stateId) {
        return stateMapper.selectByPrimaryKey(stateId);
    }

    @Override
    public int updateByExampleSelective(State record,StateExample example) {
        return stateMapper.updateByExampleSelective(record,example);
    }

    @Override
    public int updateByExample(State record,StateExample example) {
        return stateMapper.updateByExample(record,example);
    }

    @Override
    public int updateByPrimaryKeySelective(State record) {
        return stateMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(State record) {
        return stateMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<State> apparatusStateList() {
        StateExample example = new StateExample();
        example.createCriteria().andStateTypeEqualTo("仪器");
        return stateMapper.selectByExample(example);
    }



    //条件查询员工
    @Override
    public List<State> selectState() {
        StateExample example = new StateExample();
        StateExample.Criteria criteria = example.createCriteria();
        criteria.andStateTypeEqualTo("员工");
        return stateMapper.selectByExample(example);
    }

    @Override
    public List<State> jianchaList() {
        StateExample example = new StateExample();
        example.createCriteria().andStateTypeEqualTo("检查");
        return stateMapper.selectByExample(example);
    }

    @Override
    public List<State> bedStateList() {
        StateExample example = new StateExample();
        example.createCriteria().andStateTypeEqualTo("病床");
        return stateMapper.selectByExample(example);
    }

}
